﻿@{
    ViewBag.Title = "GoodsMove";
}

@model Model.AppUserList
@{
    ViewBag.Title = "OffShelves";
    Layout = "~/Views/Shared/_JQBaseLayOut.cshtml";
}
@using Model

@section JQscriptSection{
    <script src="../../Scripts/jqueryeasyui/datagrid-detailview.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var curr_time = new Date();
            var strDate = curr_time.getFullYear() + "-";
            strDate += curr_time.getMonth() + 1 + "-";
            strDate += curr_time.getDate();
            $("#checkTimeS").datebox("setValue", strDate);
            $("#checkTimeE").datebox("setValue", strDate);
            InitGrid();
        });

        HandleDom.ClassTriggerClick("icon-reload", function () {
            InitGrid();
        });

        function InitGrid() {
            var txtGoodsMoveID = $('#txtGoodsMoveID').val();
            var txtSGoodsCode = $('#txtSGoodsCode').val();
            var txtSGoodsName = $('#txtSGoodsName').val();
            var startDate = $('#checkTimeS').datebox('getValue');
            var endDate = $('#checkTimeE').datebox('getValue');

            queryParams = {
                goodsMoveID: txtGoodsMoveID,
                checkTimeS: startDate,
                checkTimeE: endDate,
                sGoodsCode: txtSGoodsCode,
                sGoodsName: txtSGoodsName
            }
            HandleData.InitDataGrid('dg', '/GoodsMove/InitJsonResult', 'toolbar', queryParams, 'GOODSMOVEID', true, function (data) { },
                function (rowIndex, rowData) {//双击
                    edit(rowData);
                });


            $('#dg').datagrid({
                view: detailview,
                detailFormatter: function (index, row) {
                    return '<div style="padding:2px"><table class="ddv"></table></div>';
                },
                onExpandRow: function (index, row) {
                    $('#dg').datagrid("loading", "正在检索数据...");
                    var ddv = $(this).datagrid('getRowDetail', index).find('table.ddv');
                    ddv.datagrid({
                        url: '/GoodsMove/QueryDetailData' + '?GOODSMOVEID=' + row.GOODSMOVEID,
                        fitColumns: true,
                        singleSelect: true,
                        rownumbers: true,
                        loadMsg: '',
                        height: 'auto',
                        columns: [[
                            { field: 'GOODSMOVEID', title: '商品货位搬移单号', align: 'center', sortable: true },
                            { field: 'GOODSBATCHCODE', title: '商品批次号', align: 'center', sortable: true },
                            { field: 'FROMLOCATIONCODE', title: '来源货位', align: 'center', sortable: true },
                            { field: 'TOLOCATIONCODE', title: '目的货位', align: 'center', sortable: true },
                            { field: 'GOODSCODE', title: '商品编码', align: 'center', sortable: true },
                            { field: 'GOODSNAME', title: '商品名称', align: 'center', sortable: true },
                            { field: 'QTY', title: '数量', align: 'center', sortable: true },
                            { field: 'UNITNAME', title: '单位', align: 'center', sortable: true },
                            //{ field: 'PURUNITNAME', title: '单位', align: 'center', sortable: true },
                            { field: 'OFFSHELVESID', title: '下架指令ID', align: 'center', sortable: true }
                        ]],
                        onResize: function () {
                            $('#dg').datagrid('fixDetailRowHeight', index);
                        },
                        onLoadSuccess: function () {
                            $('#dg').datagrid("loaded");
                            setTimeout(function () {
                                $('#dg').datagrid('fixDetailRowHeight', index);
                            }, 0);
                        },
                        loadFilter: function (data) {
                            if (data.ResponseData) {
                                return data.ResponseData;
                            } else {
                                return data;
                            }
                        }
                    });
                    $('#dg').datagrid('fixDetailRowHeight', index);
                }
            });

        }


    </script>
}

<body style="background-color: ButtonFace; font-size: 17px">
    <div class="easyui-panel" title="查询条件" style="height: 130px; padding: 5px; background: #fafafa; width: 1700px;">
        <form id="query" method="post">
            <table>
                <tr>
                    <td>商品货位搬移单号:
                    </td>
                    <td>
                        <input id="txtGoodsMoveID" name="txtGoodsMoveID" style="width: 154px" />
                    </td>
                    <td>商品编码：
                    </td>
                    <td>
                        <input id="txtSGoodsCode" name="txtSGoodsCode" style="width: 154px" />
                    </td>
                    <td>商品名称：
                    </td>
                    <td>
                        <input id="txtSGoodsName" name="txtSGoodsName" style="width: 154px" />
                    </td>
                    <td>搬移时间：
                    </td>
                    <td>
                        <input class="easyui-datebox" id="checkTimeS" name="CheckTimeS" style="width: 140px;" />
                    </td>
                    <td>~：
                    </td>
                    <td>
                        <input class="easyui-datebox" id="checkTimeE" name="CheckTimeE" style="width: 140px;" validtype="compareDate['#checkTimeS']" />
                    </td>
                    <td>
                        <a id="btnSerach" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="InitGrid()">查询</a>
                    </td>

                </tr>
            </table>
        </form>

    </div>
    <div style="min-height: 720px; width: 1700px;">
        <table id="dg" title="商品货位搬移单列表" style="min-height: 600px;">
            <thead>
                <tr>
                    <th data-options="field:'GOODSMOVEID',width:50">商品货位搬移单号</th>
                    <th data-options="field:'MOVEDATE',width:80,sortable:true,formatter:function(value, rowData, rowIndex){ return FormatData.formatDate(value);}">搬移日期</th>
                    <th data-options="field:'MOVETYPE',width:50">搬移类型</th>
                    <th data-options="field:'WAREHOUSENAME',width:30">仓库</th>
                    <th data-options="field:'CELLNO',width:30">库位</th>
                    <th data-options="field:'FLAG',width:30,sortable:true,formatter:function(value, rowData, rowIndex){ return FormatData.formatflag(value);}">状态</th>
                    <th data-options="field:'CREATOR',width:30">创建人</th>
                    <th data-options="field:'CREATEDATE',width:80,sortable:true,formatter:function(value, rowData, rowIndex){ return FormatData.formatDate(value);}">创建时间</th>
                    <th data-options="field:'EDITOR',width:30">修改人</th>
                    <th data-options="field:'EDITDATE',width:80,sortable:true,formatter:function(value, rowData, rowIndex){ return FormatData.formatDate(value);}">修改时间</th>
                    <th data-options="field:'REMARK',width:80">备注</th>
                </tr>
            </thead>
        </table>
    </div>
    @Html.Partial("~/Views/Shared/_PartialToolbar.cshtml", new Toolbar
{
    GridName = "dg",
    GridType = "datagrid",
    ToolbarName = "toolbar",
    FunctionModule = new Dictionary<string, List<FunctionModule>>()
    {
        {"Function",new List<FunctionModule>()
            {
              new FunctionModule(){Name = "Add",IsEnable =false },
              new FunctionModule(){Name = "Edit",IsEnable =false },
              new FunctionModule(){Name = "Remove",IsEnable =false },
              new FunctionModule(){Name = "Reload",IsEnable =true },
              new FunctionModule(){Name = "Collapse",IsEnable =false },
              new FunctionModule(){Name = "Exporter",IsEnable =false },
              
            }
        }
    }
})

</body>




